﻿using JuCheap.Store.IService.Models;
using JuCheap.Store.IService.Service;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;

namespace JuCheap.Store.WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class StoreController : Controller
    {
        private readonly IStoreSaveService _storeSaveService;

        public StoreController(IStoreSaveService storeSaveService)
        {
            _storeSaveService = storeSaveService;
        }

        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        [AllowAnonymous]
        [HttpPost]
        [Route("save")]
        public async Task<string> Save([FromBody]StoreSaveDTO req)
        {
            return await _storeSaveService.SaveAsync(req);
        }
    }
}